package com.example.myapplication.model;

import com.example.myapplication.base.BaseModel;
import com.example.myapplication.bean.QuestionsBean;
import com.example.myapplication.net.ResultCallBack;
import com.example.myapplication.util.HttpUtil;
import com.example.myapplication.util.ResultSubscriber;
import com.example.myapplication.util.RxUtils;

public class QuestionsModel extends BaseModel {
    public void getQuestionsData(final ResultCallBack<QuestionsBean> resultCallBack) {
        addDisposable(
                HttpUtil.getInstance()
                .getQuestionsService()
                .getData()
                .compose(RxUtils.<QuestionsBean>ttFlowableTransformer())
                .subscribeWith(new ResultSubscriber<QuestionsBean>() {
                    @Override
                    public void onNext(QuestionsBean questionsBean) {
                        resultCallBack.onSuccess(questionsBean);
                    }
                })

        );
    }
}
